﻿using RStudio.UIFramwork;
using RStudio.UIFramwork.Utils;
using UnityEngine;
using UnityEngine.UI;


/// <summary>
/// 遮罩
/// </summary>
[UIDetail("UIMask", "UIMask")]
public class UIMask : UIWidget
{
    Image m_UIMask;

    public override void InitComponent()
    {
        if (m_UIMask == null)
        {
            m_UIMask = gameObject.transform.GetComponent<Image>();

            if (m_UIMask == null)
            {
                m_UIMask = gameObject.AddComponent<Image>();
                this.SetColor(Color.grey);
            }
        }

        LayoutUtil.SetTransform(transform);
        LayoutUtil.SetOffset(transform, Vector2.zero, Vector2.zero);
        LayoutUtil.SetSibling(transform, 0);
    }


    public void SetColor(Color color)
    {
        this.m_UIMask.color = color;
    }
}